#ifndef __SEMAPHORE_H__
#define __SEMAPHORE_H__
#include <mutex>
#include <condition_variable>
#include "Nocopyable.hpp"
/*
 *自定义实现信号量
 * */
class Semaphore:public Nocopyable
{
public:
    Semaphore(size_t limit=0);
    ~Semaphore()=default;
    void post();
    void wait();
private:
    size_t count_;
    std::recursive_mutex mutex_;
    std::condition_variable_any cond_;
};

#endif
